package co.laomag.coffee.api.admins;

import co.laomag.coffee.model.entity.Admin;
import co.laomag.coffee.model.vo.Login;
import co.laomag.coffee.model.vo.Message;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

/**
 * @author 马泽朋
 * @version 1.0
 * @date 2020/4/18 下午 1:39
 */
@Api(tags = "管理员API接口")
@RequestMapping("/admin")
public interface AdminApi {

     @ApiOperation("管理员登录方法")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "username",value = "账号",required=true,defaultValue="15911075183"),
             @ApiImplicitParam(name = "password",value = "密码",required = true,defaultValue = "123456")
     })
     @ApiResponses({
             @ApiResponse(code = 200,message = "成功"),
             @ApiResponse(code = 423,message = "账号状态异常"),
             @ApiResponse(code = 424,message = "账号或密码错误")
     })
     @RequestMapping(value = "administratorLogin",method = RequestMethod.POST)
     Message administratorLogin(Login login);

     @ApiOperation("新增管理员方法")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "admin",value = "管理员对象")
     })
     @ApiResponses({
             @ApiResponse(code = 200,message = "添加成功"),
             @ApiResponse(code = 425,message = "添加失败")
     })
     @RequestMapping(value = "addAdministrator",method = RequestMethod.POST)
     Message addAdministrator(Admin admin);

     @ApiOperation("查询用户权限方法")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "token",value = "token")
     })
     @RequestMapping(value = "getRouters",method = RequestMethod.GET)
     Message getRouters(String token);
     @ApiOperation("修改用户信息")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "admin",value = "用户信息")
     })
     @RequestMapping(value = "update",method = RequestMethod.POST)
     Message update(Admin admin);

     @ApiOperation("查询用户角色")
     @RequestMapping(value = "getRoles",method = RequestMethod.GET)
     Message getRoles();


     @ApiOperation("查询所有管理员")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "title",value = "搜索参数"),
             @ApiImplicitParam(name = "page",value = "第几页"),
             @ApiImplicitParam(name = "limit",value = "每页记录数")
     })
     @RequestMapping(value = "getAdminList",method = RequestMethod.GET)
     Message getAdminList(String title,int page,int limit,String token);

     @ApiOperation("删除管理员用户")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "admin",value = "用户信息"),
     })
     @RequestMapping(value = "deleteAdmin",method = RequestMethod.POST)
     Message deleteAdmin(Admin admin);
}
